/*
package com.muc.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
public class Tcpserver {
    ServerSocket ss;
    Socket cltsocket;
    int clientNum;
    private dbConnect DB;
    private int flag_;
    public Tcpserver(dbConnect temp){
        DB=temp;
        try {
            ss = new ServerSocket(6666); //创建一个Server Socket监听在端口6666
            System.out.println("Server is ready...");
        }catch(IOException e){
            System.err.println("Failed to creat Socket");
            System.exit(1);
        }
        while(true){
            try{
                cltsocket = ss.accept(); //阻塞的accept()方法接收Client的请求,返回一个Socket对象
            }catch (IOException e) {
                System.err.println("Accept failed.");
                System.exit(1);
            }
            clientNum++;
            //创建b并启动一个线程处理一个Client的请求
            new MultiServerThread(cltsocket, clientNum,DB).start();
        }//end of while
    }

    public static void main(String[] args) throws IOException, ClassNotFoundException {
        dbConnect dataBase=new dbConnect();
        dataBase.ONLOAD();
//        dataBase.BaseDelete();
        new Tcpserver(dataBase);
        System.out.println("断开连接");
        System.exit(0);
    }
}
//线程
class MultiServerThread extends Thread
{
    private Socket cs;
    private int cltNum;
    private ServerSocket ss;
    private dbConnect DB;
    private String[] line;
    public MultiServerThread(Socket socket, int clientNumber,dbConnect DB_)
    {
        this.cs=socket;
        this.cltNum=clientNumber;
        System.out.println("Accepted Client：" + cltNum);
        DB=DB_;
    }
    public void run()
    {
        try{
            //由Socket对象获得输入流，并创建BufferedReader对象
            InputStreamReader rs=new InputStreamReader(cs.getInputStream());//打开输入流
            BufferedReader is=new BufferedReader(rs);
            //由Socket对象获得输出流，并创建PrintWriter对象
            PrintWriter os = new PrintWriter(cs.getOutputStream(),true);
            //创建键盘输入的BufferedReader对象
           // BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
            int flag;
            DB.BaseCreate();
            DB.TableCreate();
            while(true){
                flag = Integer.parseInt(is.readLine());
                if(flag>0) {
                    line = new String[3];
                    line[0] = is.readLine();
                    if (line[0].equals("exit"))
                        break;
                    line[1] = is.readLine();
                    line[2] = is.readLine();
                    if (flag == 1) {
                        System.out.println("adada");
                        DB.insertData(line[0], line[1], Boolean.parseBoolean(line[2]));
                    } else if (flag == 2) {
                        line = DB.selectData(line[0]);
                        if (line==null)
                        {
                            line=new String[3];
                            line[0]=line[1]=line[2]="none";
                        }
                        os.println(line[0]);
                        os.flush();
                        os.println(line[1]);
                        os.flush();
                        os.println(line[2]);
                        os.flush();
                    } else if (flag == 3) {
                        DB.deleteData(line[0]);
                    } else if (flag==4){
                        DB.updateData(line[0], line[1], Boolean.parseBoolean(line[2]));
                    }
                }
            }//继续循环
            is.close(); //关闭输入流
            os.close(); //关闭输出流
            cs.close(); //与一个客户通信完毕，关闭Client socket
            DB.BaseDelete();
            DB.closeData();
        }catch (IOException ie) {
            ie.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}
*/
